package com.fmatos.service.album.domain;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

@JsonInclude(Include.NON_EMPTY)
public class Photo {

	private static final DateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
	
	private String caption;
	private String url;
	private String thumbnail;
	private String link;	// link to page that contains photo
	private String description;
	private Date date;
	
	public Photo() {
		
	}
	
	public Photo(String urlBigImage, String urlThumbnail, String link,String caption) {
		this.url = urlBigImage;
		if ( urlBigImage != null && urlThumbnail != null && !urlBigImage.equals(urlThumbnail)) {
			this.thumbnail = urlThumbnail;
		}
		
		this.link = link;
		this.caption = caption;
	}

	public String getUrl() {
		return url;
	}
	
	public void setUrl(String url) {
		this.url = url;
	}
	
	public String getCaption() {
		return caption;
	}
	
	public void setCaption(String caption) {
		this.caption = caption;
	}
	
	@Override
	public String toString() {
		return "Photo [url=" + url + ", caption=" + caption + ", link=" + link
				+ "]";
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public String getThumbnail() {
		return thumbnail;
	}

	public void setThumbnail(String thumbnail) {
		this.thumbnail = thumbnail;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getDate() {
		return date;
//		
//		if ( date!=null) {
//			return DATE_FORMAT.format(date);
//		} else
//			return null;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	
	
}
